﻿@model IEnumerable<ADShop.Models.OrderProduct>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

@*<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.IDOrder)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IDUser)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IDProduct)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Quantity)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.TotalPrice)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Recipient)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AddressRecipient)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.EmailRecipient)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PhoneRecipient)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Messenger)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Active)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IDShipMethod)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IDPaymentMethod)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.IDOrder)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.IDUser)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.IDProduct)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Quantity)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.TotalPrice)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Recipient)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.AddressRecipient)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.EmailRecipient)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.PhoneRecipient)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Messenger)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Active)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.IDShipMethod)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.IDPaymentMethod)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.IDOrder }) |
            @Html.ActionLink("Details", "Details", new { id = item.IDOrder }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.IDOrder })
        </td>
    </tr>
}

</table>*@
<p>
    @Html.ActionLink("Create New", "Create", null, new { @class = "btn btn-green" })
</p>

<div class="panel panel-default">
    <div class="panel-heading">
        <i class="fa fa-external-link-square"></i>
       Đơn Đặt Hàng
        <div class="panel-tools">
            <a class="btn btn-xs btn-link panel-collapse collapses" href="#">
            </a>
            <a class="btn btn-xs btn-link panel-config" href="#panel-config" data-toggle="modal">
                <i class="fa fa-wrench"></i>
            </a>
            <a class="btn btn-xs btn-link panel-refresh" href="#">
                <i class="fa fa-refresh"></i>
            </a>
            <a class="btn btn-xs btn-link panel-expand" href="#">
                <i class="fa fa-resize-full"></i>
            </a>
            <a class="btn btn-xs btn-link panel-close" href="#">
                <i class="fa fa-times"></i>
            </a>
        </div>
    </div>
    <div class="panel-body">
        <table class="table table-hover" id="sample-table-1">
            <thead>
                <tr>
                    <th>
                        @Html.DisplayNameFor(model => model.IDOrder)
                    </th>
                    
                   
                    <th>
                        NameProduct
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Quantity)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.TotalPrice)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Recipient)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.AddressRecipient)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.EmailRecipient)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.PhoneRecipient)
                    </th>
                   
                    <th>ShipMethod</th>
                    <th>PaymenMethod</th>
                    
                    <th>Chức Năng</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var items in Model)
                {
                    <tr>
                        <td>@items.IDOrder</td>
                        
             

                        <td>@Html.ActionLink(@items.Product.NameProduct, "Details", new { id = @items.IDOrder})</td>
                        <td>@items.Quantity</td>
                        <td>@items.TotalPrice</td>
                        <td>@items.Recipient</td>

                        <td>@items.AddressRecipient</td>
                        <td>@items.EmailRecipient</td>
                        <td>@items.PhoneRecipient</td>
                      
                        <td>@items.ShipMethod.NameShipMethod</td>
                        <td>@items.PaymentMethod.NamePaymentMethod</td>
                        <td>
                            @Html.ActionLink("Sửa", "Edit", new { id = @items.IDOrder }, new { @class = "label label-warning" })
                            @Html.ActionLink("Xóa", "DeleteConfirmed", new { id = @items.IDOrder }, new { @class = "label label-danger", onclick = "return confirm('Are you sure to delete this item?')" })
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>

